//
//  HCLogSecView.m
//  HappyChildren
//
//  Created by WillyZhao on 2017/2/14.
//  Copyright © 2017年 WillyZhao. All rights reserved.
//

#import "HCLogSecView.h"

@implementation HCLogSecView

-(instancetype)initWithFrame:(CGRect)frame andImage:(NSString *)imageName placeText:(NSString *)placetext {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor whiteColor];
        
        UIImage *image = [UIImage imageNamed:imageName];
        
        self.promptImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, (frame.size.height - image.size.height)/2.0, image.size.width, image.size.height)];
        self.promptImageView.image = image;
        [self addSubview:self.promptImageView];
        
        self.promptTextField = [[UITextField alloc] initWithFrame:CGRectMake(self.promptImageView.frame.size.width+self.promptImageView.frame.origin.x+4, YBKAdaptiveH(2), frame.size.width - 30, frame.size.height)];
        self.promptTextField.placeholder = placetext;
        [self.promptTextField setValue:[UIFont systemFontOfSize:14.0] forKeyPath:@"_placeholderLabel.font"];
        [self addSubview:self.promptTextField];
        
    }
    return self;
}




/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end


@implementation HCLogThrView

-(instancetype)initWithFrame:(CGRect)frame andImage:(NSString *)imageName placeText:(NSString *)placetext images:(NSString *)imageNames placetexts:(NSString *)placetexts {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor whiteColor];
        
        UIImage *image = [UIImage imageNamed:imageName];
        
        UIImage *images = [UIImage imageNamed:imageNames];
        
        self.promptImageView = [[UIImageView alloc] initWithImage:image];
        self.promptImageView.frame = CGRectMake(10, (frame.size.height - image.size.height)/2.0, image.size.width, image.size.height);
        [self addSubview:self.promptImageView];
        
        CGFloat width_a = (frame.size.width - 28 - image.size.width-images.size.width)/2.0;
        
        self.promptTextField = [[UITextField alloc] initWithFrame:CGRectMake(self.promptImageView.frame.size.width+self.promptImageView.frame.origin.x+4, YBKAdaptiveH(2),width_a , frame.size.height)];
        self.promptTextField.placeholder = placetext;
        [self.promptTextField setValue:[UIFont systemFontOfSize:14.0] forKeyPath:@"_placeholderLabel.font"];
        [self addSubview:self.promptTextField];
        
        self.promptImageViews = [[UIImageView alloc] initWithImage:images];
        self.promptImageViews.frame = CGRectMake(self.promptTextField.frame.origin.x+self.promptTextField.frame.size.width+10, (frame.size.height - images.size.height)/2.0, images.size.width, images.size.height);
        [self addSubview:self.promptImageViews];
        
        self.promptTextFields = [[UITextField alloc] initWithFrame:CGRectMake(self.promptImageViews.frame.origin.x+self.promptImageViews.frame.size.width+4, YBKAdaptiveH(2), width_a, frame.size.height)];
        self.promptTextFields.placeholder = placetexts;
        [self.promptTextFields setValue:[UIFont systemFontOfSize:14.0] forKeyPath:@"_placeholderLabel.font"];

        [self addSubview:self.promptTextFields];
    }
    return self;
}

@end
